/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.goldentrade.negocio.beans;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Andre
 */
@Entity
@Table(name = "usuario")
@NamedQueries({
    @NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u"),
    @NamedQuery(name = "Usuario.findByCdUsuario", query = "SELECT u FROM Usuario u WHERE u.cdUsuario = :cdUsuario"),
    @NamedQuery(name = "Usuario.findByCdCorretora", query = "SELECT u FROM Usuario u WHERE u.cdCorretora = :cdCorretora"),
    @NamedQuery(name = "Usuario.findByNmUsuario", query = "SELECT u FROM Usuario u WHERE u.nmUsuario = :nmUsuario"),
    @NamedQuery(name = "Usuario.findByCpfCnpj", query = "SELECT u FROM Usuario u WHERE u.cpfCnpj = :cpfCnpj"),
    @NamedQuery(name = "Usuario.findByTipoPessoa", query = "SELECT u FROM Usuario u WHERE u.tipoPessoa = :tipoPessoa"),
    @NamedQuery(name = "Usuario.findByEmail", query = "SELECT u FROM Usuario u WHERE u.email = :email"),
    @NamedQuery(name = "Usuario.findByLgUsuario", query = "SELECT u FROM Usuario u WHERE u.lgUsuario = :lgUsuario"),
    @NamedQuery(name = "Usuario.findBySenha", query = "SELECT u FROM Usuario u WHERE u.senha = :senha"),
    @NamedQuery(name = "Usuario.findByFoneCel", query = "SELECT u FROM Usuario u WHERE u.foneCel = :foneCel"),
    @NamedQuery(name = "Usuario.findByFoneEnd", query = "SELECT u FROM Usuario u WHERE u.foneEnd = :foneEnd"),
    @NamedQuery(name = "Usuario.findByRuaEnd", query = "SELECT u FROM Usuario u WHERE u.ruaEnd = :ruaEnd"),
    @NamedQuery(name = "Usuario.findByBairroEnd", query = "SELECT u FROM Usuario u WHERE u.bairroEnd = :bairroEnd"),
    @NamedQuery(name = "Usuario.findByCidadeEnd", query = "SELECT u FROM Usuario u WHERE u.cidadeEnd = :cidadeEnd"),
    @NamedQuery(name = "Usuario.findByEstadoEnd", query = "SELECT u FROM Usuario u WHERE u.estadoEnd = :estadoEnd"),
    @NamedQuery(name = "Usuario.findByCepEnd", query = "SELECT u FROM Usuario u WHERE u.cepEnd = :cepEnd")})
public class Usuario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Column(name = "cd_usuario")
    private Integer cdUsuario;
    @Column(name = "cd_corretora")
    private Integer cdCorretora;
    @Basic(optional = false)
    @Column(name = "nm_usuario")
    private String nmUsuario;
    @Column(name = "cpf_cnpj")
    private String cpfCnpj;
    @Column(name = "tipo_pessoa")
    private String tipoPessoa;
    @Column(name = "email")
    private String email;
    @Basic(optional = false)
    @Column(name = "lg_usuario")
    private String lgUsuario;
    @Basic(optional = false)
    @Column(name = "senha")
    private String senha;
    @Column(name = "fone_cel")
    private String foneCel;
    @Column(name = "fone_end")
    private String foneEnd;
    @Column(name = "rua_end")
    private String ruaEnd;
    @Column(name = "bairro_end")
    private String bairroEnd;
    @Column(name = "cidade_end")
    private String cidadeEnd;
    @Column(name = "estado_end")
    private String estadoEnd;
    @Column(name = "cep_end")
    private String cepEnd;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cdUsuario")
    private List<Corretora> corretoraList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cdUsuario")
    private List<Operacao> operacaoList;

    public Usuario() {
    }

    public Usuario(Integer cdUsuario) {
        this.cdUsuario = cdUsuario;
    }

    public Usuario(Integer cdUsuario, String nmUsuario, String lgUsuario, String senha) {
        this.cdUsuario = cdUsuario;
        this.nmUsuario = nmUsuario;
        this.lgUsuario = lgUsuario;
        this.senha = senha;
    }

    public Integer getCdUsuario() {
        return cdUsuario;
    }

    public void setCdUsuario(Integer cdUsuario) {
        this.cdUsuario = cdUsuario;
    }

    public Integer getCdCorretora() {
        return cdCorretora;
    }

    public void setCdCorretora(Integer cdCorretora) {
        this.cdCorretora = cdCorretora;
    }

    public String getNmUsuario() {
        return nmUsuario;
    }

    public void setNmUsuario(String nmUsuario) {
        this.nmUsuario = nmUsuario;
    }

    public String getCpfCnpj() {
        return cpfCnpj;
    }

    public void setCpfCnpj(String cpfCnpj) {
        this.cpfCnpj = cpfCnpj;
    }

    public String getTipoPessoa() {
        return tipoPessoa;
    }

    public void setTipoPessoa(String tipoPessoa) {
        this.tipoPessoa = tipoPessoa;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getLgUsuario() {
        return lgUsuario;
    }

    public void setLgUsuario(String lgUsuario) {
        this.lgUsuario = lgUsuario;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public String getFoneCel() {
        return foneCel;
    }

    public void setFoneCel(String foneCel) {
        this.foneCel = foneCel;
    }

    public String getFoneEnd() {
        return foneEnd;
    }

    public void setFoneEnd(String foneEnd) {
        this.foneEnd = foneEnd;
    }

    public String getRuaEnd() {
        return ruaEnd;
    }

    public void setRuaEnd(String ruaEnd) {
        this.ruaEnd = ruaEnd;
    }

    public String getBairroEnd() {
        return bairroEnd;
    }

    public void setBairroEnd(String bairroEnd) {
        this.bairroEnd = bairroEnd;
    }

    public String getCidadeEnd() {
        return cidadeEnd;
    }

    public void setCidadeEnd(String cidadeEnd) {
        this.cidadeEnd = cidadeEnd;
    }

    public String getEstadoEnd() {
        return estadoEnd;
    }

    public void setEstadoEnd(String estadoEnd) {
        this.estadoEnd = estadoEnd;
    }

    public String getCepEnd() {
        return cepEnd;
    }

    public void setCepEnd(String cepEnd) {
        this.cepEnd = cepEnd;
    }

    @XmlTransient
    public List<Corretora> getCorretoraList() {
        return corretoraList;
    }

    public void setCorretoraList(List<Corretora> corretoraList) {
        this.corretoraList = corretoraList;
    }

    @XmlTransient
    public List<Operacao> getOperacaoList() {
        return operacaoList;
    }

    public void setOperacaoList(List<Operacao> operacaoList) {
        this.operacaoList = operacaoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cdUsuario != null ? cdUsuario.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Usuario)) {
            return false;
        }
        Usuario other = (Usuario) object;
        if ((this.cdUsuario == null && other.cdUsuario != null) || (this.cdUsuario != null && !this.cdUsuario.equals(other.cdUsuario))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return nmUsuario;
    }
    
}
